import request from "@/utils/requestUser";
// 定义登录的接口
interface loginModel {
   username: string;
   password: string;
   repassword?: string;
   code?: string;
}
// 定义token的接口
interface tokenModel {
   token: string;
}
interface codeModel {
   code: number;
   data: string;
   message: string;
}
interface registerModel {
   code: number;
   message: string;
   data: null;
}
export default {
   // 登录
   // /api/user/passport/login
   login(formData: loginModel) {
      return request.post<any, tokenModel>(`/user/passport/login`, formData);
   },
   // 注册
   // /api/user/passport/register
   register(formData: loginModel) {
      return request.post<any, registerModel>(
         `/user/passport/register`,
         formData
      );
   },
   // 获取验证码
   reqCode(phone: string) {
      return request.get<any, codeModel>(`/user/passport/sendCode/${phone}`);
   },
   // 退出登录
   reqLogout() {
      return request.get<any, null>(`/user/passport/logout`);
   },
};

// /api/user/passport/logout
// export const reqLogout = () => {
//    return request.get(`/user/passport/logout`);
// };
// 获取验证码
// /api/user/passport/sendCode/{phone}
